﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL.BussinessClass;
using Model;
namespace AlltrustDinner.Pages.Users
{
    public partial class OrderLog : System.Web.UI.Page
    {
        private string deleteImgStr = "<img src='../../Images/cancel.png' style='float: left; margin-left: 2px; margin-right: 3px; width: 20px; height: 20px;' title='删除' alt='' onclick='deleteItem(this);' />";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                OrderBiz biz = new OrderBiz();
                USER currUser = Session["CurrentUser"] as USER;
                List<ITEM> list = biz.LoadUserItemHistoryList(currUser.NAME);
                var scrlist = list.OrderByDescending(c => c.TIME).Select(c => new
                {
                    ID = c.ID,
                    NAME = c.NAME,
                    DINNER = c.DINNER,
                    PRICE = c.PRICE,
                    RESTURANT = c.RESTURANT,
                    TIME = c.TIME,
                    REMARK = c.REMARK,
                    DELETEIMG = c.TIME.ToString("yyyyMMdd") == DateTime.Now.ToString("yyyyMMdd") ? deleteImgStr : ""
                });
                this.rpt_order_history_list.DataSource = scrlist;
                this.rpt_order_history_list.DataBind();
            }
        }
    }
}